package com.hyj.serve.manage.enums;

import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

/**
 * @author HeYuJie
 * @date 2022/6/6
 */
@Getter
public enum FirewallAction {

    ACCEPT("accept", "允许"),
    DROP("drop", "拒绝");

    @JsonValue
    private final String code;
    private final String name;

    FirewallAction(String code, String name) {
        this.name = name;
        this.code = code;
    }

    public static FirewallAction valueOfCode(String code){
        for (FirewallAction value : FirewallAction.values()) {
            if(value.code.equals(code)){
                return value;
            }
        }
        return null;
    }
}
